﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace ATC
{
    public class cl_0423_Mediator : cl_0423_AbstractATC
    {
        private int index = 1;
        private string temp = null;
        private Hashtable members = new Hashtable();

        public override void InScope(cl_0423_TrafficControl tc)
        {
            
            string FLY = tc.getFlight();
            Console.WriteLine(FLY+"进入管辖范围");
            if (!members.Contains(tc))
            {
              tc.getFlight();
                tc.setATC(this);
            }
            
        }

        public override void ChooseWay(string information,string flight)
        {
            if (information == "飞行")
            {
                Console.WriteLine(flight+"继续飞行");
            }
            else
            {
                if (index == 1 || temp != information)
                {
                    Console.WriteLine(flight+"申请"+information+"成功");
                    Console.WriteLine("其余航班请绕开本站点");
                    index++;
                    temp = information;
                }
                else
                {
                    Console.WriteLine("已有航班在"+information+","+flight+"申请失败");
                }
            }
            
        }
    }
}